﻿package mortal.game.utils
{
    import Message.BroadCast.*;
    import Message.Game.*;
    import Message.Public.*;
    import mortal.game.resource.info.*;
    import mortal.game.view.common.*;

    public class PlayerUtil extends Object
    {

        public function PlayerUtil()
        {
            return;
        }// end function

        public static function isVIP(param1:SMiniPlayer) : Boolean
        {
            return param1.VIP > 0;
        }// end function

        public static function copyPubicToMiniPlayer(param1:SPublicPlayer) : MiniPlayerInfo
        {
            var _loc_2:* = new MiniPlayerInfo();
            _loc_2.entityId = param1.entityId;
            _loc_2.name = param1.name;
            _loc_2.sex = param1.sex;
            _loc_2.career = param1.career;
            _loc_2.camp = param1.camp;
            _loc_2.level = param1.level;
            _loc_2.VIP = param1.VIP;
            _loc_2.online = param1.online;
            _loc_2.combat = param1.combat;
            _loc_2.robotId = param1.killNum;
            return _loc_2;
        }// end function

        public static function copyEntityInfoToMiniPlayer(param1:SEntityInfo) : MiniPlayerInfo
        {
            var _loc_2:* = new MiniPlayerInfo();
            _loc_2.entityId = param1.entityId;
            _loc_2.name = param1.name;
            _loc_2.sex = param1.sex;
            _loc_2.career = param1.career;
            _loc_2.camp = param1.camp;
            _loc_2.level = param1.level;
            _loc_2.VIP = param1.VIP;
            _loc_2.online = true;
            _loc_2.combat = param1.combat;
            _loc_2.guildId = param1.guildId.id;
            _loc_2.robotId = param1.code;
            _loc_2.groupId = param1.groupId;
            return _loc_2;
        }// end function

        public static function convertToMiniPlayerInfo(param1) : MiniPlayerInfo
        {
            var _loc_2:SFriendRecord = null;
            var _loc_3:MiniPlayerInfo = null;
            if (param1 is SFriendRecord)
            {
                _loc_2 = param1 as SFriendRecord;
                _loc_3 = new MiniPlayerInfo();
                ClassTypesUtil.copyClassValue(_loc_3, _loc_2.friendPlayer, false);
                return _loc_3;
            }
            return null;
        }// end function

        public static function convertSMiniPlayerToMiniPlayerInfo(param1:SMiniPlayer) : MiniPlayerInfo
        {
            var _loc_2:* = new MiniPlayerInfo();
            _loc_2.entityId = param1.entityId;
            _loc_2.name = param1.name;
            _loc_2.sex = param1.sex;
            _loc_2.career = param1.career;
            _loc_2.camp = param1.camp;
            _loc_2.level = param1.level;
            _loc_2.VIP = param1.VIP;
            _loc_2.online = true;
            _loc_2.combat = param1.combat;
            _loc_2.guildId = param1.guildId;
            return _loc_2;
        }// end function

    }
}
